package com.az.miaoauth.controller;

import com.az.miaoauth.domain.dto.EmailCodeDto;
import com.az.miaoauth.domain.dto.MessagePasswordDto;
import com.az.miaoauth.service.LoginService;
import com.az.servicecommon.domain.Vo;
import com.az.servicecommon.util.BaseResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@BaseResponse
@RequestMapping("/auth/login")
@RequiredArgsConstructor
public class LoginController {

    private final LoginService loginService;

    @PostMapping("/password")
    public Vo passwordLogin(MessagePasswordDto messagePasswordDto) {

        return loginService.loginByPassword(messagePasswordDto);
    }


    @PostMapping("/email")
    public Vo codeLogin(EmailCodeDto emailCodeDto) {

        return loginService.loginByEmail(emailCodeDto);
    }
}
